
aimodel_t model;

// Layer definition
uint16_t input_layer_shape[] = {1, 9};
ailayer_input_f32_t   input_layer    = AILAYER_INPUT_F32_A(2, input_layer_shape);
ailayer_dense_f32_t   dense_layer_1  = AILAYER_DENSE_F32_A(30);
ailayer_relu_f32_t    relu_layer_1   = AILAYER_RELU_F32_A();
ailayer_dense_f32_t   dense_layer_2  = AILAYER_DENSE_F32_A(20);
ailayer_relu_f32_t    relu_layer_2   = AILAYER_RELU_F32_A();
ailayer_dense_f32_t   dense_layer_3  = AILAYER_DENSE_F32_A(9);
ailayer_softmax_f32_t softmax_layer  = AILAYER_SOFTMAX_F32_A();

// Model parameters (Weights and Biases)
const uint32_t parameter_memory_size = 4436;
const uint32_t model_parameters[ 1109 ] PROGMEM = {
    0x3E7E099B, 0x3F64EA8C, 0xBF9D3408, 0x3EA2FC49, 0x3DB763ED, 0xBFBA59CD, 0x3EA08E7B, 0x3F0C43FA,
    0xBF91D6EE, 0x3F22B9DC, 0x3E9C39D5, 0x3F5DED6B, 0xBF3152F7, 0xBE833B14, 0x3FC47A9F, 0xBFA6074F,
    0xBF9176FF, 0x3FDEFA8D, 0x3F9A44C5, 0x3FB6DC11, 0xBF586C11, 0x3DA9141B, 0xBE9B779E, 0xBDDBA16E,
    0xBFA69617, 0xBFB0FAF2, 0xBE13D876, 0x3EF845D4, 0xBEAEBA53, 0xC00B1451, 0xBFA37ADA, 0x3EFD8940,
    0x3D33E1A6, 0xBFF0088A, 0xBF5A19E8, 0xBEA3E9EE, 0xBE0AE457, 0x3FBB00CF, 0x3F101EC4, 0xBFA7B579,
    0xBF3D7873, 0xBF3EDE87, 0xBFD16357, 0x3F6F6D9F, 0xBFA78ACA, 0xBFA6B77C, 0xBF99D8D1, 0xBF04F407,
    0x3F78F5B4, 0x3E3947B2, 0x3DE494C0, 0x3FD2A34B, 0x3F84E8DA, 0xBF398A68, 0x3FD6F702, 0x3EEB49F9,
    0x3EC3D2FC, 0x3EF0AE7C, 0x3FE79216, 0x3F0F1B19, 0x3F95E6AA, 0x3F300E26, 0x3FC71AD5, 0x3F53BB53,
    0xBF2F8B26, 0x3D3F6A6B, 0x3F44D2A5, 0x3F23D6E3, 0x3DC94B7F, 0xBF8405CD, 0xBFB30B83, 0xBF9ACD8B,
    0x3F18FB7B, 0xBFDDAC08, 0xBF1B48BE, 0x3E201785, 0xBF5A12B3, 0x3D2AD947, 0x3F98FB09, 0x3E578C47,
    0xBFD78EBF, 0xBF4D5F9E, 0x3E9FA366, 0x3FDC24B2, 0x3E8F592D, 0xBE971554, 0x3EDDC587, 0x3E0CF00A,
    0xBED41315, 0x3E00E9F4, 0x3FBE4930, 0xC0054678, 0xBE0997B2, 0xBEDF066D, 0x3F98AE43, 0xBDD50E71,
    0x3EFA9DB5, 0x3EF9234A, 0x3E35C495, 0x3E7B03DF, 0x3FDA7976, 0x3F608681, 0xBF614AC5, 0xBF83C41E,
    0xBD61CD10, 0x3F21D7D2, 0xBE94CF58, 0xBE12AE99, 0xBF777B59, 0x3F39EDEE, 0x3F525223, 0x3F47125A,
    0x3EE006B5, 0xBF2D8A38, 0xBF26E658, 0x3F5430EC, 0x3D992801, 0x3F2DE07C, 0xBFDE878A, 0x3F3555BC,
    0xBE7BF0F0, 0x3EC0D13B, 0xBF2273C5, 0x3D893DB6, 0x3FDA142C, 0xBF87E000, 0x3F61364B, 0x3E99853E,
    0x3EDE6BFF, 0x3FB6BEEE, 0xBF35FDDD, 0xBD69620C, 0x3F96B50B, 0xBE861AE0, 0xBEF2AB16, 0xBF833248,
    0x3DC4828D, 0xBFDB7A0F, 0xBF3FC445, 0xBFDF3BC2, 0x3F93685B, 0xBF5E0243, 0x3F18C41F, 0xBF4028C7,
    0xBF34C1A7, 0x3FC0C19C, 0x3FCA9015, 0xBFCD1314, 0x3DC3AFA5, 0x3F894353, 0x3FC4F726, 0x3F8D0303,
    0x3F05C2F2, 0xBF1EDF6C, 0xBECC1D87, 0x3F395454, 0x3EB33598, 0x3D892BC2, 0x3F882CBD, 0x3E1F8375,
    0x3EAD2FF7, 0x3FB9B212, 0x3F24623C, 0xBF62B732, 0xBE398141, 0x3F896D22, 0xBF07C7DD, 0xBEEAA487,
    0xBFA2FB77, 0xBEC0CE1C, 0xBF0097A6, 0xBEB3428C, 0xC0092CD4, 0xBF0854A8, 0x3F6E3B7A, 0x3F403667,
    0x3D7D4066, 0x3F03938D, 0xBF69AFEC, 0x3EC111BE, 0xBF2704E7, 0x3EBF7FF1, 0xBF9380A0, 0x3F8D3089,
    0x3D467891, 0x3FCE8E69, 0x3FB145DF, 0xC0044A2F, 0x3F27B305, 0xBE462D94, 0xBF15E529, 0x3ECDAC15,
    0xBF069F06, 0x3E981C10, 0xBF21B6F7, 0x3F5DA256, 0x3F59915C, 0xBEA7C2AD, 0xBF8B9804, 0x3EA83DBF,
    0x3FD88E21, 0xBEBFB3CE, 0x3EFCC5FD, 0xBDFF2FD3, 0xBF634A17, 0xBEB516DB, 0xBFAA0DCA, 0x3F872FD5,
    0xBEBD8283, 0xBDA278F8, 0xBF814C44, 0xBDBBB2DB, 0x3EBA857A, 0x3F9CD34B, 0xBF3BEB9D, 0x3E88E760,
    0x3E5EA634, 0x3F4D594E, 0xBC902CA7, 0xBFB17C7A, 0x3ECE66EF, 0xBF763E4C, 0xBD52960A, 0x3F4B9F5E,
    0xBF990350, 0xBF1831DE, 0x3F81FA92, 0xBF232968, 0xBF1CF57D, 0x3D6C1DE2, 0x3F6C1BE9, 0xBFA4F2AF,
    0x3EAC134A, 0xBED434D7, 0x3EE99B9F, 0x3F7952E4, 0xBF5A394D, 0x3F18BB85, 0x3EC0CF18, 0x3EBEB2B5,
    0xBFB68F03, 0x3F819417, 0x3F614B20, 0x3F3BA564, 0xBF4F881E, 0xBFA63E67, 0xBFEA3AAC, 0x3E5E8BC4,
    0x3EC716A0, 0x3F50D69F, 0x3F228E4F, 0x3D74D961, 0x3F7744A5, 0xBD2CD0F7, 0xBF444701, 0x3FABEA6D,
    0x3FB48771, 0x3EF00A31, 0xBF93C0B5, 0xBD949BB0, 0xBF07451D, 0xBF869DBE, 0xBF100DB5, 0x3B47C7AF,
    0x3E8F7B4C, 0xBF61C291, 0xBEE77701, 0x3F14F16C, 0x3F479B0E, 0xBC8707C2, 0x3F29FE55, 0x3EEEA794,
    0xBD65EFCF, 0x3F098DD5, 0x3EEB1F91, 0x3F8C4A7E, 0x3EFFC942, 0x3F0EB903, 0x3EDFCB94, 0x3EE6EB12,
    0x3DA5C2D4, 0x3D92F675, 0x3EF534DF, 0x3F931DD1, 0xBED89156, 0x3F190F60, 0x3EFFFDB0, 0xBCCE7D88,
    0x3FAA6EB8, 0x3EA66A00, 0x3E747EAF, 0x3F74B9A5, 0x3F270766, 0xBF0AC097, 0x3F317416, 0xBDE89E83,
    0xBE13BBBF, 0x3EF834A3, 0x3EF84855, 0x3F0EF3C1, 0xBF04BBA6, 0xBD055EA8, 0xBE23D1A8, 0xBF4B9C88,
    0x3F3BF9E3, 0xBF939381, 0xBD1F21DA, 0xBF86AF94, 0xBF1BF245, 0xBEB9BD05, 0x3F92401F, 0x3F3B4497,
    0x3DE0320E, 0x3F16E26D, 0xBF7FA5DD, 0x3DD0CDC4, 0xBE9FB47C, 0x3F97B440, 0x3FCE1A7C, 0x3DB81DAA,
    0xBED19462, 0xBFA886B5, 0xBBA2F5C6, 0x3F21D85E, 0xBFA9A308, 0xBF88EC64, 0x3F1F3074, 0x3F84B0FA,
    0x3FA17F4E, 0x3DF38DC4, 0x3E5AFC17, 0x3D70AB4B, 0x3EB8A245, 0x3F490A49, 0xBD2F4361, 0x3E1087D2,
    0x3F3170B8, 0xBFAF98C0, 0x3E3943B5, 0x3FB34AAE, 0x3F580987, 0xBE0AEA8F, 0xBF80B745, 0x3D517FA9,
    0x3EF0C1DC, 0x3E774F08, 0xBEA7DBBA, 0xBDFFEB10, 0x3DA95286, 0x3E96E399, 0xBF3DE7C2, 0x3FC39E30,
    0x3D8EC513, 0xBEE21B12, 0xBF6C4236, 0xBE8B0CCC, 0x3F03C184, 0xBF1D7CE8, 0x3E7F366D, 0xBD850CFF,
    0x3F855B8A, 0x3F09CEFD, 0xBDB932C2, 0xBF3130E5, 0xBEDFE645, 0xBEA91C3B, 0x3F221ADA, 0xBEB8021B,
    0xBEF72FC7, 0xBFF16241, 0x3F18CDD1, 0xBEAA3BBC, 0xBF03A0C6, 0x3EB61B6F, 0x3F374D05, 0xBF1A39FC,
    0x3EA9F127, 0xBF52854E, 0x3FBE9201, 0xBF5938C8, 0xBECE3AA0, 0xBF6BA147, 0xBF8E6516, 0x3F597EE6,
    0x3FAD569D, 0x3F07BEBB, 0x3F7378B5, 0x3F21C4B3, 0xBF0D621B, 0xBED5D6A5, 0xBCB2C248, 0x3E092946,
    0x3DA8A40C, 0xBE3A46A4, 0xBEFF08DA, 0x3F1233EF, 0x3E741A2A, 0xBF2B394A, 0x3F345E61, 0xBF5780E5,
    0x3F78D3B3, 0xBEC9AC79, 0x3F5A8FC9, 0xBE8E8E58, 0x3F5ECA6F, 0xBF8C54C7, 0x3E0B76F8, 0xBED9CA14,
    0x3E97BEC3, 0xBE6866A9, 0xBE3E4E9B, 0x3F8AAED3, 0x3F4F1F6B, 0x3F82C2CB, 0xBC63C672, 0xBF71336A,
    0x3F4247DD, 0x3DC3C0CF, 0xBF540F2F, 0x3F8BA427, 0x3ED4B863, 0x3F239EEC, 0x3F26424F, 0x3F87F1B9,
    0xBF079335, 0x3FA1ED84, 0xBFCEE835, 0xBE1CFD26, 0x3EDF48AD, 0xBE3AB0AB, 0x3E15BECB, 0xBF2A5283,
    0xBF1DD284, 0xBF61D5E9, 0xBE91853A, 0x3E605510, 0xBF008850, 0x3F22CAEB, 0x3FC3211A, 0x3D975DE7,
    0x3F0D87F4, 0xBF016F49, 0x3EF4B1A4, 0xBF245D56, 0x3F9023CC, 0xBF057A2F, 0x3FA2D3EC, 0x3EB4A798,
    0x3FDA51C1, 0x3DEC4A76, 0xBF3BD06D, 0x3FA8AC5F, 0xBDFC7636, 0x3E96E294, 0x3E47DACE, 0x3E0209ED,
    0xBFD4E7C7, 0x3F3DEC13, 0x3E5EF7AF, 0xBE34B22A, 0xBE78049A, 0x3E635FC7, 0x3E45CBCE, 0xBF260996,
    0x3DF403D6, 0x3E9EA1EF, 0xBEFB2417, 0x3E94A7B6, 0x3F4E5DAC, 0x3E940474, 0xBF4D3DDB, 0x3DB078EF,
    0x3F0D207D, 0xBFADCCE6, 0xBEF9DF2B, 0xBD40F71C, 0x3F82A1A9, 0x3F455EA9, 0xBDC57F13, 0xBE17D319,
    0x3D71DB23, 0x3F9E5B43, 0x3FA0946E, 0x3F50BF04, 0x3F737B28, 0xBECE2254, 0x3F381A16, 0xBEA38EA6,
    0x3EF98802, 0x3E4E70C9, 0xBF0F59B9, 0x3F90D6A9, 0xBE1F2B78, 0x3E874F0B, 0x3F56DE24, 0x3E027751,
    0xBF3B04F4, 0xBF0566B8, 0xBED9E541, 0xBEE0412A, 0xBF818D47, 0x3E2EF0CD, 0xBF4095AC, 0x3F996F19,
    0x3F1C6487, 0x3F108B42, 0xBEDC0CF5, 0x3D1E6369, 0xBED92F37, 0xBEBDDFE7, 0x3F022207, 0xBF78309C,
    0x3E7B2ED5, 0x3F045A57, 0x3F21D86B, 0xBF29451B, 0x3E83B3B4, 0x3E0C960C, 0x3EB70C26, 0x3EF272FD,
    0x3E577ACF, 0x3FA9CC75, 0x3EEB0CCE, 0x3D21B2BC, 0xBE5D0342, 0x3F451198, 0xBE4C7AA4, 0xBE4A54CA,
    0xBF279F9D, 0x3F7E59F4, 0x3F43D7E8, 0xBE96F31F, 0xBF0748AE, 0x3ED07880, 0x3F251FFB, 0x3EFD6F0B,
    0xBE02B264, 0x3F269931, 0xBD1859FD, 0x3F8C34C4, 0x3F0C186A, 0x3F84E19F, 0xBD428000, 0x3D81A780,
    0xBE1D39AD, 0x3FD9428A, 0x3DBB4AC7, 0x3FAF9085, 0xBF0D119D, 0xBF5D4462, 0x3E89C0B4, 0x3E1D2ECD,
    0x3EF49299, 0x3F188BB2, 0xBF4E315B, 0x3E502A9E, 0x3E083268, 0xBDF0E4CD, 0x3F530233, 0xBCBC17D9,
    0x3DE48097, 0x3F8D32F9, 0xBF1F829D, 0xBE7E998C, 0xBF516CC5, 0x3F27E3BD, 0x3EC1A948, 0x3EF95304,
    0x3F57BD3E, 0xBDC3DEBF, 0xBE88CE4F, 0xBF29B79A, 0xBDC71B06, 0x3EE84574, 0x3FECBE9C, 0x3E6D4A77,
    0x3F843104, 0xBECACE05, 0xBF37FDCC, 0x3F2920A6, 0xBE7094F2, 0x3F131C20, 0xBF645A5D, 0xBF9B6A13,
    0x3EB916B1, 0xBE9168F8, 0xBED97F4C, 0xBEA3C800, 0x3F859879, 0xBFF6B263, 0xBF221291, 0xBDC9CCF7,
    0x3F9B8FE4, 0xBF14A5E1, 0x3F4EE8B4, 0x3F00A734, 0x3F99FBE7, 0x3F247E6A, 0xBF3380E3, 0xBFA804D2,
    0xBF1F4FBB, 0xBF112820, 0x3F390108, 0x3EB9661C, 0x3F525A3E, 0x3E1DB904, 0xBF66FE53, 0x3F2F02E2,
    0x3F7334CC, 0xBF591524, 0x3F965CE3, 0xBE2CCA73, 0xBE87EF8A, 0xBED4E57C, 0x3F4BFC10, 0xBF89C152,
    0xBE2177EB, 0x3F2E50C0, 0x3FA9D58A, 0xBF84CE7F, 0xBEC946D0, 0x3D865FB6, 0x3EBC55E9, 0x3E0A9254,
    0xBF5BA5D9, 0x3EBF97C6, 0x3E085C50, 0xBF04BDF4, 0x3F719E4F, 0xBEF93993, 0xBEDB6446, 0xBEA109D9,
    0xBF9BF725, 0x3FA07577, 0xBF027158, 0x3EA64087, 0xBE038578, 0x3FB829DC, 0x3E57D7C4, 0xBE88958A,
    0xBD084FF7, 0x3D954CD0, 0x3F5E1E5A, 0x3E9C78D0, 0xBDCEDCA6, 0xBF140EFC, 0xBF477E46, 0xBED4FE1D,
    0x3F8E3E1F, 0xBF179DBB, 0xBE4AA641, 0xBE119DEF, 0x3FDACEC6, 0xBF631A3D, 0x3CCB7D17, 0xBEEC0E30,
    0xBCBEDFD6, 0x3F941178, 0x3F5D2DB3, 0xBF230F8B, 0x3F66B719, 0xBE583F39, 0xBECFB62E, 0x3F5F4A6D,
    0xBEAE475F, 0x3E9A141E, 0xBEFF6FDF, 0x3F9F5C94, 0x3F5D416B, 0x3EB3A13D, 0x3E7B69B1, 0x3F883C6B,
    0x3F8324AF, 0x3E0640A5, 0xBFFE913E, 0xBE69A706, 0x3EB0F151, 0x3F7BA5A6, 0xBF47ACFA, 0x3ECA98D1,
    0x3F4B2E36, 0xBF18C092, 0x3DAB71AC, 0x3F8DCF61, 0xBF6EC5A1, 0x3F857A6B, 0xBF140189, 0xBEF43032,
    0xBF3F6854, 0x3F0EB290, 0xBF016E47, 0xBE6711CD, 0xBE0B13F1, 0x3F0B5403, 0x3F194872, 0xBF2095DA,
    0x3E12EE1A, 0x3F6DB8BE, 0x3D67344E, 0x3F805BAD, 0x3F5CD234, 0xBFC72567, 0x3FA74C79, 0x3E1A8A08,
    0x3F67936D, 0xBF0509B2, 0x3EA2D34C, 0x3FE71A4A, 0x3F2D0737, 0x3EB05623, 0x3E804F8E, 0x3EBE8030,
    0xBF2B39E4, 0x3E038B63, 0x3F42947B, 0x3EA18BD0, 0xBBDF9805, 0xBE723972, 0x3F47E245, 0xBE6A5817,
    0x3E93BFD2, 0xBEA2B241, 0xBE156595, 0x3F347FB4, 0x3F12C2C1, 0xBE9BF81E, 0x3F1E827B, 0xBD33C014,
    0xBF46B434, 0x3F7DB7E7, 0x3FA9DA84, 0x3EF43252, 0x3E33CC16, 0xBDC1A691, 0x3F6293E7, 0x3F7AF01F,
    0x3E3AC4DC, 0xBC40BB2F, 0xBF9E7482, 0xBF8C7E8C, 0xBE478B15, 0x3FB21B3A, 0x3D11198D, 0xBE6B3859,
    0xBEA8CFF9, 0xBE5157F0, 0x3F534A65, 0x3EFB7B26, 0x3EA2305C, 0x3F789480, 0x3F94F005, 0x3EBC5FF5,
    0x3EC059F7, 0x3EA9C0C1, 0xBEF079F6, 0xBE0C5777, 0x3F8C136F, 0x3F74DE9C, 0xBEE416B8, 0xBEB94013,
    0x3F85ED49, 0x3F12E363, 0xBEF4E463, 0xBEE9A919, 0xBE972EE3, 0x3EBCB1EA, 0x3F1FD386, 0xBFB50DF0,
    0xBF0550C0, 0xBEE7FAD8, 0x3FBFA43E, 0x3F76BF61, 0xBF805CC6, 0xBF76B3D7, 0xBE9545BC, 0xBF5C2A82,
    0xBE3C98E3, 0xBDB5A433, 0x3E007B4E, 0x3F1BF010, 0xBE776E27, 0x3F7343BE, 0x3F3E8C29, 0x3F57BFE2,
    0xBD58AE9D, 0x3E1C3DC7, 0x3DED0262, 0xBFAF4A77, 0xBF0B9BEE, 0x3FA0AEAF, 0x3F0A3E2B, 0x3DE6727A,
    0x3E4B70A0, 0x3FA8CECE, 0xBF4A5048, 0xBEBB47CC, 0x3F99951A, 0xBEAFE448, 0xBEF1A993, 0x3EFBE69C,
    0xBFA93FFB, 0x3EAE66B1, 0x3FA2F330, 0x3F2088CE, 0x3E8D27E6, 0x3F67E052, 0xBF32D4DC, 0xBC369AEB,
    0xBCF2365D, 0xBF148A99, 0x3EF3F0F1, 0xBF56B618, 0xBF4F35B4, 0xBF0B207E, 0x3F99D43D, 0x3EC6D603,
    0xBF15E12D, 0x3F0F7A1F, 0xBF495302, 0x3E55B8B2, 0xBF523087, 0xBF594702, 0x3EE4E2E2, 0x3DC90C20,
    0xBF484EC2, 0x3EE39CE8, 0x3F038AC6, 0xBF74B04E, 0xBF94F3A9, 0xBE94F513, 0xBE7DFB85, 0x3EC6C4A6,
    0xBEB123FC, 0x3DE25567, 0xBD96205C, 0x3FE07E86, 0x3F15AC4D, 0x3EB2ACE2, 0x3F91F3EF, 0x3DE4318F,
    0xBEB73933, 0xBEC2CA84, 0x3C9187E5, 0x3F500DFB, 0x3C8E3801, 0x3DFA016E, 0xBDC6111B, 0xBF25E274,
    0x3DBEA774, 0xBF3DF044, 0xBFA2A705, 0x3FE274C2, 0xBF92291B, 0x3EC5B123, 0x3F2F9BB2, 0x3EDBD025,
    0x3FB005B9, 0x3F24DC31, 0xBE20CA77, 0xBF0F31E5, 0x3F8C51D4, 0x3F44EC02, 0xBFA12EA4, 0x3F181775,
    0xBF1A15F5, 0x3FCA3AE1, 0xBE3EA62C, 0xBFBB9739, 0xBCA960AC, 0x3F602742, 0xBF3D5471, 0x3E4F5F4D,
    0xBEF8A787, 0xBF47A763, 0x3E27EF46, 0x3F56787F, 0xBF014E92, 0x3DA5F2FE, 0x3EC70EEF, 0x3FBE2320,
    0xBE806925, 0x3ED2E494, 0xBF326C9E, 0xBF2FF77E, 0x3F822795, 0xBCAC321D, 0xBF32A126, 0xBE942543,
    0x3F9972C2, 0xBC3C1ED2, 0xBE70600B, 0xBF9197D6, 0x3F383F88, 0xBF55F18A, 0x3E93ABC7, 0xBEA8B7C9,
    0x3FC5ED7A, 0xBD2A75E2, 0xBF530B62, 0xBE01163E, 0x3F8D8461, 0x3F44E416, 0x3EB2E56E, 0xBEDA0AF8,
    0x3F551EE6, 0xBE1767D7, 0xBF09600C, 0x3F062054, 0x3CF79C14, 0x3F778688, 0x3F4D31BC, 0xBE29964E,
    0x3F16AD84, 0xBEC34550, 0x3F4265A9, 0xBE02E6E1, 0xBE850091, 0xBDB152E7, 0xBEDBC5D5, 0x3E6C83BC,
    0x3E2DF133, 0xBF971140, 0xBF25FBB7, 0x3FB8BDD4, 0x3F99637E, 0x3FF61871, 0xBF92DB47, 0xBFC6FB4E,
    0xBE676AC2, 0xBF28A2DA, 0x3F4DE1ED, 0x3E1E1862, 0x3FE3BE4D, 0x3FAF2440, 0xC007CD02, 0x3F8B20A4,
    0xBF9493DA, 0xBF62893C, 0x3FC1F200, 0x3E1BD01B, 0x3ECEB2EC, 0x3FEACA50, 0x3E1282F1, 0xBFE9ECCB,
    0xBF9DE7E8, 0x3E8A92B0, 0xBFB3501F, 0x3FACF9B9, 0xBEA714E4, 0x3FAFA0BD, 0xBFAC866B, 0xBF22D9E1,
    0x3F5FB80C, 0x3F9A6697, 0xBFF56262, 0xBFDECBFD, 0xBF3AD42C, 0x3EB2A9AC, 0x3E60DEE3, 0x3E1FCFD6,
    0x3FA01F43, 0x3FCC845D, 0xBFFB534B, 0xC000CCFE, 0xBEB971BA, 0x3F9F7458, 0x3F9C9113, 0xBF3A90B3,
    0x3FA9B7C2, 0xBFBB7B1C, 0x3F641539, 0x3F5399F3, 0x3EBD87E8, 0xC007274D, 0x3F71992C, 0xBEE21099,
    0xBD99A3CD, 0xBFD4157C, 0x3FB2C390, 0xBFA032DC, 0xBF31DF59, 0xBD8710C1, 0x3FA8A0D0, 0x3FA82224,
    0x3F9E4D5B, 0x3FC9C8BB, 0xBF632D08, 0xBFCA3FFE, 0xBE162B56, 0xBFBA90B0, 0x3E92F5F8, 0x3F898F2D,
    0xBFC5A5B1, 0x3F7FE54C, 0x3FB31F4F, 0xBF8B1753, 0x3FF84E34, 0x3E79DB42, 0xBFAE092C, 0x3F8B61F0,
    0x3F022667, 0x3EDD1A7A, 0xC00F7F44, 0x3FCD6242, 0x3F71945D, 0x3F9E537E, 0xBDAAC0FB, 0xBDDFC99A,
    0x3F302EF4, 0x3F1B72A7, 0x3F26EB41, 0x3B541322, 0xBFDD404F, 0xBFD0C1ED, 0x3FBECD67, 0xBF9B92E9,
    0x3FB093DF, 0xBC8E806B, 0xBE0B11B1, 0x3FA451C4, 0x3FDAF2CC, 0xBF899BD7, 0x3F567D5A, 0xBF9008FE,
    0xBE4D8F98, 0xBFD12088, 0x3ED4BCCA, 0x3FEC9FAE, 0xC00F212E, 0xBE029718, 0x3F04330A, 0xBCCD7ED1,
    0x3FC431E5, 0xBE9553F6, 0x3FD07002, 0xBF4615E5, 0x3EE2309E, 0x3FB94E2B, 0xBF923E1B, 0x3EC2EC51,
    0xBFAF8BE9, 0xBF8B25A7, 0xBF38F980, 0x3F4B858C, 0xBF8B24BC, 0x3FB77BA9, 0x3E1432DB, 0x3F28DCF5,
    0xC00A8AF1, 0x3FA4A05F, 0x3F6992B4, 0x3F569700, 0x3C616178, 0x3F7390A9, 0x3FA3B7E4, 0xBF50CB14,
    0xBF577859, 0xBEBEEEE1, 0x3DEB3A30, 0xBFDCF4CC, 0x3F11B2D4, 0x3F86104D, 0x3FE62BB9, 0x3F6093D4,
    0xBFDCA430, 0xBE4B3C71, 0x3F460072, 0xBE4A93B1, 0xBFD34037, 0x3F586F1F, 0x3FE19A33, 0x3E87F974,
    0x3F9E3B6D, 0x3F14A3F4, 0x3EF88C9B, 0x3EE46A38, 0x3F2CE5FF, 0xBFAF3695, 0xBFD035E2, 0xBF2E7FA7,
    0x3FCFC5C1, 0xBFC1DB95, 0x3E45D0A6, 0xC005786A, 0x3FC0DA7E, 0xBE2D1709, 0x3D15E5E7, 0x3FB087FD,
    0x3F8FB5D3, 0x3F9E4266, 0x3DC8AA2D, 0x3FF2CBC1, 0x3F961973, 0xBF83136E, 0xBFC351F3, 0x3F5DC11A,
    0xBE3B37F2, 0x3B0C18BE, 0x3F6A3AE0, 0xC003B73A, 0xBB5196A6, 0xBE463926, 0xBE20F162, 0x3DE94728,
    0x3EAED07C, 0xBE175D7F, 0x3DB586EA, 0x3D8E7CE7, 0xBD898C1B
};


void init_ai_agent()
{
  // Layer pointer to perform the connection
  ailayer_t *x;

  #if __AVR__
  // Only on AVR contollers (e.g. Arduino UNO) with weights in PROGMEM

  // Connect the layers to build a model
  model.input_layer = ailayer_input_f32_default(&input_layer);
  x = ailayer_dense_f32_avr_pgm(&dense_layer_1, model.input_layer);
  x = ailayer_relu_f32_default(&relu_layer_1, x);
  x = ailayer_dense_f32_avr_pgm(&dense_layer_2, x);
  x = ailayer_relu_f32_default(&relu_layer_2, x);
  x = ailayer_dense_f32_avr_pgm(&dense_layer_3, x);
  x = ailayer_softmax_f32_default(&softmax_layer, x);
  model.output_layer = x;

  #elif __arm__ && defined USE_CMSIS_ACCELERATION_ON_ARM
  // Only on ARM contollers (e.g. Arduino Nano 33 BLE). AIFES_WITH_CMSIS must be activated in aifes_config.h and CMSIS-DSP library must be available in the AIfES_for_Arduino library.

  // Connect the layers to build a model
  model.input_layer = ailayer_input_f32_default(&input_layer);
  x = ailayer_dense_f32_cmsis(&dense_layer_1, model.input_layer);
  x = ailayer_relu_f32_default(&relu_layer_1, x);
  x = ailayer_dense_f32_cmsis(&dense_layer_2, x);
  x = ailayer_relu_f32_default(&relu_layer_2, x);
  x = ailayer_dense_f32_cmsis(&dense_layer_3, x);
  x = ailayer_softmax_f32_default(&softmax_layer, x);
  model.output_layer = x;

  #else

  // Connect the layers to build a model
  model.input_layer = ailayer_input_f32_default(&input_layer);
  x = ailayer_dense_f32_default(&dense_layer_1, model.input_layer);
  x = ailayer_relu_f32_default(&relu_layer_1, x);
  x = ailayer_dense_f32_default(&dense_layer_2, x);
  x = ailayer_relu_f32_default(&relu_layer_2, x);
  x = ailayer_dense_f32_default(&dense_layer_3, x);
  x = ailayer_softmax_f32_default(&softmax_layer, x);
  model.output_layer = x;

  #endif

  // Finish the model creation by checking the connections and setting some parameters for further processing
  aialgo_compile_model(&model);

  // Distribute the memory to the trainable parameters of the model
  aialgo_distribute_parameter_memory(&model, (void *) model_parameters, parameter_memory_size);

  Serial.print(F("\n-------------- AI agent model structure ---------------\n"));
  aialgo_print_model_structure(&model);
  Serial.print(F("--------------------------------------------------------\n\n"));
  
  Serial.print("The weights need "); Serial.print(parameter_memory_size); Serial.println(" bytes of memory.");

  // Allocate memory for intermediate results of the inference
  uint32_t inference_memory_size = aialgo_sizeof_inference_memory(&model);
  Serial.print("The model needs "); Serial.print(inference_memory_size); Serial.println(" bytes of memory for inference.\n");
  void *inference_memory = malloc(inference_memory_size);

  // Schedule the memory to the model
  aialgo_schedule_inference_memory(&model, inference_memory, inference_memory_size);
}

uint8_t run_ai_agent(float *board)
{
  uint16_t board_shape[2] = {1, 9};
  aitensor_t board_tensor = AITENSOR_2D_F32(board_shape, board);

  aitensor_t *out_tensor = aialgo_forward_model(&model, &board_tensor);
  float *out_data = (float *) out_tensor->data;

  // Calculate the most probable index (argmax)
  float maxi = out_data[0];
  uint8_t argmax = 0;
  for(uint8_t j = 1; j < 9; j++){
    if(out_data[j] > maxi){
        maxi = out_data[j];
        argmax = j;
    }
  }

  return argmax;
}
